Add compile-time validation for dangerous property names in expressions#14829
Merged
Add compile-time validation for dangerous property names in expressions#14829
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add compiler validation for forbidden field names in expressions
Add compile-time validation for dangerous property names in expressions
Feb 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds compile-time validation to block dangerous JavaScript property names in GitHub Actions expressions (e.g., constructor, __proto__) to prevent prototype-pollution style access patterns, aligning compile-time checks with existing runtime protections.
Changes:
- Introduces a
DangerousPropertyNamesblocklist constant. - Adds
validateExpressionForDangerousProps()and runs it early during single-expression validation. - Expands expression safety tests to cover blocked properties and end-to-end markdown validation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/workflow/expression_validation.go | Adds dangerous-property detection and integrates it into expression validation flow. |
| pkg/constants/constants.go | Defines the dangerous property name blocklist used by the validator. |
| pkg/workflow/expression_safety_test.go | Adds unit + integration-style tests for dangerous property validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
This reverts commit c10cefe. The commit introduced undefined regex variables (dangerousPropSplitRe, numericIndexRe) that were never added to the var block, breaking compilation. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add compile-time validation for dangerous property names in expressions
Extends the runtime protection from #14826 by blocking dangerous JavaScript property names at compile time. Prevents prototype pollution attacks via expressions like
${{ github.constructor }}or${{ inputs.__proto__ }}.Changes
DangerousPropertyNamesinpkg/constants/constants.golists 13 blocked property names (constructor, proto, prototype, toString, valueOf, etc.)validateExpressionForDangerousProps()inpkg/workflow/expression_validation.goparses dot/bracket notation and checks property names against the blocklistvalidateSingleExpression()before other checksExample
Compilation now fails with a clear error:
Safe expressions continue to work:
${{ github.actor }} ✓ ${{ github.event.issue.number }} ✓ ${{ needs.job.outputs.result }} ✓💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.